from django.db import models

# Create your models here.
class UserModel(models.Model):
    mobile = models.CharField(max_length=11,verbose_name='手机号')
    password = models.CharField(max_length=256,verbose_name='密码')
    class Meta:
        db_table = 'tb_user'
    def __str__(self):
        return self.mobile

class AddrModel(models.Model):
    name = models.CharField(max_length=30,verbose_name='收件人')
    mobile = models.CharField(max_length=11,verbose_name='手机号')
    addr = models.CharField(max_length=100,verbose_name='收货地址')
    user = models.ForeignKey(UserModel,on_delete=models.CASCADE,verbose_name='所属用户')
    class Meta:
        db_table = 'tb_addr'
    def __str__(self):
        return self.name
